class ListNode {
      int val;
      ListNode next;
      ListNode() {}
      ListNode(int val) { this.val = val; }
      ListNode(int val, ListNode next) { this.val = val; this.next = next; }
  }


public class Test {
    //leetcode 24 两两交换链表中的节点
    public ListNode swapPairs(ListNode head) {
        if (head == null || head.next == null) return head;
        ListNode curNext = head.next.next;
        ListNode ret = head.next;
        head.next.next = head;
        head.next = swapPairs(curNext);

        return ret;
    }
}
